package cn.sskxyz.security.authorization.service;

import cn.sskxyz.mybatis.mode.Page;
import cn.sskxyz.security.authorization.dao.SecurityScopeDao;
import cn.sskxyz.security.authorization.model.SecurityScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SecurityScopeService {

    @Autowired
    private SecurityScopeDao securityScopeDao;

    public void addSecurityScope(SecurityScope securityScope) {
        securityScopeDao.insertSecurityScope(securityScope);
    }

    public Page<List<SecurityScope>> querySecurityScopeList(int currentPage, int pageSize) {
        Page page = new Page(currentPage, pageSize);
        List<SecurityScope> scopes = securityScopeDao.selectSecurityScopeList(page);
        page.setData(scopes);
        return page;
    }

    public void changeSecurityScope(SecurityScope securityScope){
        securityScopeDao.updateSecurityScope(securityScope);
    }
}
